home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 1.6 KB | 64 lines | [TEXT/MPS ] |
- {
- readLocation
-
- retrieves the map settings for longitude and latitude and
- the time offset from GMT
-
- for more information, see Worldwide Development: Guide to System Software
-
- Greg Robbins 12/91
-
- }
-
- { requires SIOW for WriteLn }
-
- PROGRAM location;
-
- USES Types, Script, FixMath;
-
- VAR
- myMachineLocation: MachineLocation;
- latExt, longExt: EXTENDED;
- latDeg, latMin, longDeg, longMin: LONGINT;
- theGmtDelta, hours, minutes, seconds: LONGINT;
-
- FUNCTION GetGmtDelta(myLocation: MachineLocation): LONGINT;
- VAR
- internalGmtDelta: LONGINT;
- BEGIN
- { change 3-byte integer to LONGINT }
- internalGmtDelta := BAND(myLocation.gmtDelta,$00FFFFFF);
- IF BTST(internalGmtDelta,23) THEN { sign extend }
- internalGmtDelta := BOR(internalGmtDelta,$FF000000);
- GetGmtDelta := internalGmtDelta;
- END;
-
- BEGIN
- ReadLocation(myMachineLocation);
-
- { convert location to extended fraction }
- latExt := Frac2X(myMachineLocation.latitude);
- longExt := Frac2X(myMachineLocation.longitude);
-
- { convert location to degrees-minutes }
- latDeg := TRUNC(latExt * 90);
- latMin := TRUNC((latExt * 90 - latDeg) * 60);
-
- longDeg := TRUNC(longExt * 90);
- longMin := TRUNC((longExt * 90 - longDeg) * 60);
-
- { find time zone w.r.t. GMT }
- theGmtDelta := GetGmtDelta(myMachineLocation);
- hours := theGmtDelta DIV 3600;
- minutes := (theGmtDelta MOD 3600) DIV 60;
- seconds := theGmtDelta MOD 60;
-
- { negative values indicate South or West }
- WriteLn('latitude: ', latDeg, CHR($A1), latMin, CHR($27));
- WriteLn('longitude: ', longDeg, CHR($A1), longMin, CHR($27));
-
- { negative values indicate West }
- WriteLn('time from GMT: ', hours:3, ' h ', minutes:3, ' m ',
- seconds:2, ' s');
- END.
-